import 'dart:async';
import 'dart:collection';
import 'dart:typed_data';

import 'package:flutter/services.dart';

const blackWriteTitle = ['默认', '深色背景', '深灰色', '普通', '浅灰色背景', '浅色背景', '白色背景'];
const removalRedTitle = ['默认', '红褐', '深红', '普通', '红色', '大红', '浅红'];
const removalBlueTitle = ['默认', '蓝黑', '深蓝', '普通', '蓝色', '天蓝', '浅蓝'];

const blackWriteVals = [1000, 5, 11, 19, 30, 42, 55];
const removalRedVals = [5, 0, 9, 13, 25, 36, 50];
const removalBlueVals = [3, 0, 9, 19, 25, 36, 50];

class Handwritingprocessing {
  static const MethodChannel _channel =
      const MethodChannel('handwritingprocessing');

  ///@type B0001黑白，B0010去红，B0100去蓝，B0110去红蓝，B0111黑白去红蓝
  ///@patchSize 修补大小(红蓝笔迹大小)
  ///@blackWriteVal 黑白值 背景颜色和文字颜色色差越大，设置值越高(0-60)
  ///@removalRedVal 去红值 背景颜色和红色色差越大，设置值越高(0-50)
  ///@removalBlueVal 去蓝值 背景颜色和蓝色色差越大，设置值越高(0-50)
  static Future<dynamic> handwriting(Uint8List byteData, int type,
      {blackWriteVal = 1000,
      removalRedVal = 20,
      removalBlueVal = 5,
      patchSize = 6}) async {
    /// Variable to store operation result
    final dynamic result = await _channel.invokeMethod('handwriting', {
      'byteData': byteData,
      'type': type,
      'blackWriteVal': blackWriteVal,
      'removalRedVal': removalRedVal,
      'removalBlueVal': removalBlueVal,
      'patchSize': patchSize,
    });
    return result;
  }
}
